package com.tiger.weightcheck;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends BaseActivity {
	PreferenceDataUtil util=new PreferenceDataUtil(this);
	private Button lookresult,startcheck,easyread;
	private TextView maindesc;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);
        CommonUtil.setAdView(this, this);
        
        lookresult=(Button)this.findViewById(R.id.lookresult);
        startcheck=(Button)this.findViewById(R.id.startcheck);
        maindesc=(TextView)this.findViewById(R.id.maindesc);
//        easyread=(Button)this.findViewById(R.id.easyread);
        
        lookresult.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				String checkResult=util.ReadSharedPreferences(util.CHECKRESULT, "-1");
				if(checkResult.equals("-1")){
					maindesc.setText("未进行测试无测试结果，请开始测试");
				}else{
					MainActivity.this.startActivity(new Intent(MainActivity.this,ResultActivity.class));
				}
			}
        });
        startcheck.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				MainActivity.this.startActivity(new Intent(MainActivity.this,CheckActivity.class));
			}
        	
        });

    }
}